package com.qcq.wecheck.constant;

import java.awt.print.PrinterAbortException;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *
 * </p>
 *
 * @author O
 * @version 1.0
 * @since 2018/10/17
 */
public class WxDeveloperConstant {
	/**
	 * 微信小程序固定参数
	 */
	public static final String URL = "https://api.weixin.qq.com/sns/jscode2session";
	private static final String SECRET = "e06c1a09dd723ff7a68b532658a544ff";
	private static final String GRANT_TYPE = "authorization_code";
	private static final String APP_ID = "wx8cc3b1a59e85d93b";


	public static Map<String, String> getOpenIdParams(String jsCode) {
		Map<String, String> params = new HashMap<>();
		params.put("appid", APP_ID);
		params.put("secret", SECRET);
		params.put("grant_type", GRANT_TYPE);
		params.put("js_code", jsCode);
		return params;
	}

	public static String getFullUrl(String jsCode) {
		return URL + "?appid=" + APP_ID
				+ "&secret=" + SECRET
				+ "&grant_type=" + GRANT_TYPE
				+ "&js_code=" + jsCode;
	}
}
